<include file="Public/common" />
<block name="css">
    <style>
        th{text-align:center;}
    </style>
</block>
<block name="content">
    <div class="page-header"><h1>首页 > 财务管理 &gt;财务结算</h1></div>
    <ul id="nav" class="nav nav-tabs">
      <li role="presentation"  <if condition="$post['status'] eq -1">class="active"</if> ><a href="javascript:checkStatus(-1);">待结算</a></li>
      <li role="presentation"  <if condition="$post['status'] eq 1">class="active"</if> ><a href="javascript:checkStatus(1);">结算中</a></li>
      <li role="presentation" <if condition="$post['status'] eq 2">class="active"</if>  ><a href="javascript:checkStatus(2);">已结算</a></li>
    </ul>
    <div class="tab-content">
        <div class="row" >
            <form action="" class="form-inline " method="get" style="margin-left:10px;" >
                <input type="hidden" name="status" value="{$post.status}" style="display: none;">
                <div class="form-group">
                    <label for="group_num">团号</label>
                    <input type="text" class="" name="group_num" id="group_num" placeholder="团号" value="{$post.group_num}">
                </div>
                <div class="form-group">
                    <label for="line_name">线路名称</label>
                    <input type="text" class="" name="line_name" id="line_name" placeholder="线路名称" value="{$post.line_name}">
                </div>
                <div class="form-group">
                    <label for="operator_name">合作运营商</label>
                    <input type="text" class="" name="operator_name" id="operator_name" placeholder="合作运营商" value="{$post.operator_name}">
                </div>
                <button type="submit" class="btn btn-primary btn-sm">查询</button>
            </form>
        </div>


        <div class="col-xs-12"  style="margin-top:10px;">

            <button class="btn btn-primary btn-xs pull-right" type="button" id="dropdownMenu1" data-toggle="dropdown">
                筛选
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownMenu1" style="padding:10px;">
                <!--<li><input type="checkbox" class="filtrate" checked value="1" id="filtrate_1"> <label for="filtrate_1">ID</label> </li>-->
                <li><input type="checkbox" class="filtrate"checked value="2" id="filtrate_2"><label for="filtrate_2">线路名称</label></li>
                <li><input type="checkbox" class="filtrate"checked value="3" id="filtrate_3"><label for="filtrate_3">线路编号</label></li>
                <li><input type="checkbox" class="filtrate"checked value="4" id="filtrate_4"><label for="filtrate_4">团号</label></li>
                <li><input type="checkbox" class="filtrate"checked value="5" id="filtrate_5"><label for="filtrate_5">成团时间</label></li>
                <li><input type="checkbox" class="filtrate"checked value="6" id="filtrate_6"><label for="filtrate_6">出团时间</label></li>
                <li><input type="checkbox" class="filtrate"checked value="7" id="filtrate_7"><label for="filtrate_7">已收客</label></li>
                <li><input type="checkbox" class="filtrate"checked value="9" id="filtrate_9"><label for="filtrate_9">其它费用</label></li>
                <li><input type="checkbox" class="filtrate"checked value="10" id="filtrate_10"><label for="filtrate_10">结算总金额</label></li>
                <li><input type="checkbox" class="filtrate"checked value="11" id="filtrate_11"><label for="filtrate_11">合作运营商</label></li>
                <li><input type="checkbox" class="filtrate"checked value="12" id="filtrate_12"><label for="filtrate_12">成团状态</label></li>
                <li><input type="checkbox" class="filtrate"checked value="13" id="filtrate_13"><label for="filtrate_13">结算状态</label></li>
                <if condition="$post['status'] gt 1">
                    <li><input type="checkbox" class="filtrate"checked value="14" id="filtrate_14"><label for="filtrate_14">结算时间</label></li>
                    <li><input type="checkbox" class="filtrate"checked value="15" id="filtrate_15"><label for="filtrate_15">结算人</label></li>
                </if>
                <!--<li><input type="checkbox" class="filtrate"checked value="12" id="filtrate_12"><label for="filtrate_12">结算状态</label></li>-->
            </ul>
            <if condition="checkAuth('Dealer/Finance/exportExcelFinanceList')">
                <a href="{:U('exportExcelFinanceList',array('status'=>$post['status']))}" class="btn btn-primary btn-xs pull-right" style="margin-right: 10px">导出</a>
            </if>
            <div class="pull-right" style="margin-right:10px;font-weight: bold;">总结算金额统计：￥{$totalCostMoney|default="0.00"}元 </div>
        </div>
        <table class="table table-striped table-bordered table-hover table-condensed text-center">
            <thead>
            <tr>
                <!--<th class="filtrate_1" >ID &lt;!&ndash;<input type="checkbox" class="checkAll">&ndash;&gt;</th>-->
                <th class="filtrate_2" >线路名称</th>
                <th class="filtrate_3" >线路编号</th>
                <th class="filtrate_4" >团号</th>
                <th class="filtrate_5" >成团时间</th>
                <th class="filtrate_6" >出团时间</th>
                <th class="filtrate_7">已收客</th>
                <!--<th class="filtrate_8" >预计收客</th>-->
                <th class="filtrate_9" >其它费用</th>
                <th class="filtrate_10" >结算总金额</th>
                <th class="filtrate_11" >合作运营商</th>
                <th class="filtrate_12" >成团状态</th>
                <th class="filtrate_13" >结算状态</th>
                <if condition="$post['status'] gt 1">
                    <th class="filtrate_14" >结算时间</th>
                    <th class="filtrate_15" >操作人</th>
                </if>
                <th >操作</th>
            </tr>
            </thead>
            <tbody>
            <volist name="list" id="vo">
                <tr >
                    <!--<td class="filtrate_1" >{$vo.group_id} &lt;!&ndash;<input type="checkbox" class="chk">&ndash;&gt;</td>-->
                    <td class="filtrate_2">{$vo.line_name}</td>
                    <td class="filtrate_3">{$vo.line_sn}</td>
                    <td class="filtrate_4">{$vo.group_num}</td>
                    <!-- <td class="filtrate_5">运营商</td>-->
                    <td class="filtrate_6">
                        <if condition="$vo['group_time']">
                            {$vo.group_time|date="Y-m-d",###}
                        </if>
                     </td>
                    <td class="filtrate_7">{$vo.out_time|date="Y-m-d",###}</td>
                    <td class="filtrate_8">{$vo.received_num}</td>
                    <td class="filtrate_9">{$vo.addition_money}</td>
                    <td class="filtrate_10">{$vo.actually_money}</td>
                    <!--<td class="filtrate_10">{$vo.cost_total_money}</td>-->
                    <td class="filtrate_11">{$vo.operator_name} </td>
                    <td class="filtrate_12">
                        <switch name="vo.group_status">
                            <case value="0">待处理</case>
                            <case value="1">已成团</case>
                            <case value="2">已出团</case>
                            <case value="3">已回团</case>
                            <case value="-1">不成团</case>
                        </switch>
                    </td>
                    <td class="filtrate_13">
                        <switch name="vo.closing_status">
                            <case value="-1">待结算</case>
                            <case value="1">结算中</case>
                            <case value="2">已结算</case>
                            <case value="3">已确认结算</case>
                        </switch>
                    </td>
                    <if condition="$post['status'] gt 1">
                        <td class="filtrate_14">
                            <if condition="$vo['closing_time']">
                                {$vo.closing_time|date="Y-m-d",###}
                                <else/>
                                无
                            </if>
                        </td>
                        <td class="filtrate_15">{$vo.handle_user|default="无"}</td>
                    </if>
                    <td >
                        <if condition="checkAuth('Dealer/Product/groupDetail')">
                            <a href="{:U('Product/groupDetail',array('id'=>$vo['group_id']))}" class="btn btn-primary btn-xs">详情</a>
                        </if>
                        <if condition="checkAuth('Dealer/Finance/groupWindup')">
                            <if condition="$vo['closing_status'] eq -1">
                                <a href="{:U('groupWindup',array('id'=>$vo['id'],'closing_status'=>1))}" class="btn btn-primary btn-xs">发起结算</a>
                                <elseif condition="$vo['closing_status'] eq 2"/>
                                <a href="{:U('groupWindup',array('id'=>$vo['id'],'closing_status'=>3))}"  class="btn btn-primary btn-xs">确认完成结算</a>
                            </if>
                        </if>
                    </td>
                </tr>
            </volist>
            <tr>
                <td colspan="<if condition="$post['status'] gt 1">14<else/>12</if>">
                    <!--分页样式-->
                    <ul class="pagination">
                        {$show}
                    </ul>
                </td>
            </tr>
            </tbody>
        </table>

    </div>
</block>
<block name="js">
    <script>
        function checkStatus(status) {
            $('form')[0].reset();
            $('input[name="status"]').val(status);
            $('form').submit();
        }

        //筛选显示
        $('body').on('change','.filtrate',function () {
            var id=$(this).val();
            if($(this).is(':checked')){
                $('.filtrate_'+id).show();
            }else{
                $('.filtrate_'+id).hide();
            }
        });

    </script>
</block>
